package org.abacus.client.ui.view;

import org.abacus.client.common.ExitHelper;
import org.abacus.client.ui.access.AccessData;
import org.abacus.client.ui.access.AccessDataFactory;
import org.eclipse.swt.widgets.Shell;

public class AccessDataProvider {

	private AccessDataProvider() {
		super();
	}

	public static AccessData getAccessData(String id) {
		AccessDataFactory accessDataFactory = AccessDataFactory.getInstance();
		AccessData ad = accessDataFactory.createAccessData(id, DisplayProvider.getDisplay());
		if (ad.getControl() instanceof Shell) {
			ad.getControl().addDisposeListener(ExitHelper.disposeListener);
			ad.getControl().pack();
			((Shell) ad.getControl()).open();
		}
		return ad;
	}

}
